feat: persist journal hashes to hot storage#151
Open
Fraser999 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e485653 to
3adfca6
Compare
6da1ac1 to
52a4458
Compare
3adfca6 to
2426bf3
Compare
52a4458 to
627967d
Compare
2426bf3 to
d20fab8
Compare
d20fab8 to
71e300e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The producer's rolling
previous_journal_hashwas an in-memoryMutex<B256>placeholder. This PR persists the keccak of each block's wire-encoded journal alongside the block in hot storage and seeds the next emit from there, making the rolling hash crash- and revert-safe.Changes
encode_journalnow stampsExecutedBlock::journal_hash, whichUnifiedStorage::append_blockspersists into the newJournalHasheshot table;previous_journal_hashreads it back viaHotDbRead::get_journal_hash(falling back toGENESIS_JOURNAL_HASHonly for empty storage or pre-JournalHashesupgrades, and only while the in-process chain is itself fresh).emit -> append -> notify, so a post-emit failure leaves storage at N-1 and a fresh-chain restart re-emits N deterministically againsttip = None;notifylast soeth_subscribe("newHeads")clients querying storage immediately after the broadcast see block N already indexed.on_host_revertnow returns aRevertOutcome { changed, shutdown }: when the post-revert target is genesis or has been evicted from the chain's ring buffer, storage and tags are drained, the post-notification tag refresh still runs (so reth gets aFinishedHeightmatching post-drain state), then the node bails with an explanatory error. A tag-refresh failure on the shutdown path is logged viaerror!so it can't mask the shutdown error.#[ignore = "ENG-2017: ..."]markers from the reorg tests inmultiple-blocks.rsandreorg.rs; reorg tests that previously reverted to height 0 now reorganize down to height 1 instead, since the new code bails on a true revert-to-genesis.test_journal_hash_persisted_after_process_block(db.rs) covering the persistence write, andtest_revert_to_genesis_bails(basic.rs) covering the new bail path.Notes
[patch.crates-io]until the storage repo is published.🤖 Generated with Claude Code